package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@RestController
@SpringBootApplication
@EnableEurekaClient
public class DemoApplication1 {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication1.class, args);
    }


    /**

     * 假如这个客户端要提供一个getUser的方法

     * @return

     */

    @GetMapping(value = "/getUser")

    @ResponseBody

    public Map<String,Object> getUser(@RequestParam Integer id){

        Map<String,Object> data = new HashMap<>();

        data.put("id",id);

        data.put("userName","admin");

        data.put("from","provider-B");

        return data;

    }


    @RequestMapping(value = "/getbook", method = RequestMethod.POST)
    @ResponseBody
    public Map book2(@RequestBody Map<String, Object> book) {

        // System.out.println(book.getName());


        book.put("price",44);

        return book;

    }
}
